﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CassirApp
{
  public partial class Return : Form
  {
    public Return(int id)
    {
      InitializeComponent();
      this.id = id;
    }
    private int id;

    private void label7_Click(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
      TrainManagerClient tmClient = new TrainManagerClient();
      Mads.CoreDomain.TicketToReturn ticket = tmClient.GetTicketByNumber(id, tbId.Text);
      textBox1.Text = ticket.RouteNumber.ToString();
      textBox2.Text = ticket.CarNumber.ToString();
      textBox3.Text = ticket.SitNumber.ToString();
      if (tmClient.ReturnTicket(id, tbId.Text))
      {
        MessageBox.Show("Сдача билета прошла успешно!");
      }
      else
      {
        MessageBox.Show("При сдаче билета произошла ошибка. Повторите процедуру еще раз.");
      }
    }
  }
}
